home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #2 / Ham Radio 2000 - Volume 2.iso / HAMV2 / MISC / DTMFF110 / FILELIST.TXT < prev    next >
Text File  |  1996-09-18  |  5KB  |  162 lines

  1. This source code was written for Borland C++ 3.1 or 4.0, and Borland's TASM
  2.  
  3. Documentation files:
  4.  filelist.txt - This file
  5.  dtmf_fft.txt - Documentation of program options
  6.  
  7. General program files:
  8.  freq.c          - Main program loop
  9.  setupsub.c   - Routines for program initialization
  10.  procinp.c    - Routines for keyboard input
  11.  realfft.c    - FFT routines
  12.  realffta.asm - Alternate assembly version of FFT (optional--DOS only)
  13.  freq.h          - General header file and function prototypes
  14.  extern.h     - Global variable definitions
  15.  fft.h          - FFT code prototypes
  16.  display.h    - Definition of generalized graphics functions
  17.  
  18. DOS Graphics support files
  19.  gr_dos.c     - Functions for mapping the graphics calls to Borland C's BGI
  20.  egavga.obj   - Borland BGI graphics library routines
  21.  
  22. Files required for SB8 support
  23.  sc_sb.c      - Routines for SB recording
  24.  sb.h          - SB definitions
  25.  dma_code.asm - DMA routines (Copyright (C) 1992, Heath I Hunnicutt)
  26.  sb_dsp.asm   - SB control routines (Copyright (C) 1992, Heath I Hunnicutt)
  27.         (Note: Heath's routines may be found via FTP from:
  28.         ftp.inf.tu-dresden.de/pub/ms-dos/sound/program/sb_dsp.zip
  29.         and dma_code.zip. )
  30.  
  31. Files required for SB16 support
  32.  sc_sb16.c    - Routines for SB16 recording
  33.  sbio.c          - SB16 low-level control and DMA routines
  34.         (Copyright (C) 1995, Ethan Brodsky)
  35.         (Full source for Ethan's routines may be found at
  36.          ftp://oak.oakland.edu/simtel/msdos/sound/sb16snd.zip)
  37.  
  38. To add support for additional soundcards, you need to add the following
  39. changes to the code:   (Replace CARD with an appropriate name in
  40. what follows.)
  41.  
  42. The soundcard must be added (with an unique number) to the list of supported
  43. soundcards in the freq.h file, and the function prototypes defined:
  44. ----- freq.h -----
  45. /* Defines for soundcard usage. */
  46. #define SC_SB8       0
  47. #define SC_SB16       1
  48. #define SC_CARD       2
  49.  
  50. /* Function prototypes for the CARD soundcard */
  51. void init_CARD(void);
  52. void reset_CARD(void);
  53. void halt_CARD(void);
  54. void cleanup_CARD(void);
  55. void recordblock_CARD(void far * buffer);
  56. void set_mixer_CARD(int channel,int level);
  57. ----- freq.h -----
  58.  
  59. You should add a couple lines near the end of freq.c to report the soundcard
  60. name when the program exits:
  61. ----- freq.c -----
  62. #ifdef SC_CARD
  63.    if(Soundcard==SC_CARD) printf(" in CARD NAME mode.");
  64. #endif
  65. ----- freq.c -----
  66.  
  67. Then you need to set the pointers to the soundcard's functions and set the
  68. sample size and mixer ability (and any other soundcard-specific initialization
  69. such as getting the BLASTER environment variable data) in an initialization
  70. function called from setupsub.c:
  71. ----- setupsub.c -----
  72. #ifdef SC_CARD
  73.    if(Soundcard==SC_CARD)
  74.       init_card();
  75. #endif
  76. ----- setupsub.c -----
  77.  
  78. You then need to write the routines for running the soundcard, probably in
  79. the file sc_CARD.c, as follows:
  80. ----- sc_CARD.c -----
  81. #include "freq.h"
  82. #include "extern.h"
  83.  
  84. void far interrupt CARDHandler()
  85. {
  86.    // Interrupt handler for when the DMA transfer has filled a buffer.
  87.    // Put whatever card-specific code is required here, and set the flags:
  88.    flag[record_buffer]=1;
  89.    if(++record_buffer>=BUFFERS)
  90.       record_buffer=0;
  91. }
  92.  
  93. void init_CARD(void)
  94. {
  95.    /* Perform assorted soundcard initialization */
  96.    /* This function is called once at program initialization */
  97.  
  98.    reset_soundcard=reset_CARD;
  99.    halt_soundcard=halt_CARD;
  100.    cleanup_soundcard=cleanup_CARD;
  101.    recordblock=recordblock_CARD;
  102.    set_mixer=set_mixer_CARD;     // If mixers are supported
  103.    sample_size=8;   // Bits per sample (8 or 16)
  104.    mixers=0;        // Mixers supported (1) or not supported (0)
  105.  
  106.    /* Set up interrupt handler routine here */
  107. }
  108.  
  109. void halt_CARD(void)
  110. {
  111.    // This function is called to halt and reset the DMA process
  112.    // so that buffer pointers may be changed.
  113.    // It is called before changing the sound card settings.
  114. }
  115.  
  116. void reset_CARD(void)
  117. {
  118.    // This function is called every time the settings change.
  119.    // Initialize the card and DMA, and set the sampling rate
  120.    // to the value given in the variable "SamplingRate"
  121.  
  122.    // Reset the buffer pointers
  123.    queue_buffer=0;     // Pointer to next buffer to be queued
  124.    record_buffer=0;    // Pointer to next buffer to be filled
  125.    process_buffer=0;   // Pointer to next buffer to be FFTed
  126.    for(i=0;i<BUFFERS;i++)
  127.       flag[i]=0;
  128.  
  129.    // Start the DMA process.
  130.    recordblock_CARD((char *)buffer[queue_buffer]);
  131.    if(++queue_buffer>=BUFFERS)
  132.       queue_buffer=0;
  133. }
  134.  
  135. void cleanup_CARD(void)
  136. {
  137.    // This function is called once, just before the program exits
  138.    // Halt the DMA and reset the card
  139.    // Restore old interrupt handler
  140. }
  141.  
  142. void recordblock_CARD(void far * buffer)
  143. {
  144.    // This function is called once for every block to record
  145.    // Start the DMA process to record the block of data which is pointed
  146.    // to by "buffer"; recording a total of "fftlen" samples
  147.    // The CARDHandler routine should be called (most likely via interrupts)
  148.    // after this block has been recorded.
  149. }
  150.  
  151. void set_mixer_CARD(int channel,int level)
  152. {
  153.    // Set the specified mixer level
  154.    // channels is MIXER_INT, MIXER_EXT, or MIXER_MIC
  155.    // level is a percentage on, 0 to 100, where 100 is full volume
  156. }
  157. ----- sc_CARD.c -----
  158.  
  159. And finally, you need to link this code (along with any soundcard-specific
  160. libraries) with the main program.
  161.  
  162.